package com.joysuch.wwyt.bp.repository;

import com.joysuch.wwyt.bp.entity.inspect.BpAppPlanTask;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;

import java.time.LocalDate;
import java.util.List;

/**
 * @Author ZhangDong
 * @Date 2020/3/10 16:45
 */
public interface BpAppPlanTaskRepository extends JpaRepository<BpAppPlanTask, Long>, JpaSpecificationExecutor<BpAppPlanTask> {

    //List<BpAppPlanTask> findByStatus

    List<BpAppPlanTask> findByCheckUserId(Long checkUserId);

    List<BpAppPlanTask> findByCheckUserIdAndCheckDateAndStatus(Long checkUserId, LocalDate checkDate, String status);

    List<BpAppPlanTask> findByCheckUserIdAndStatus(Long checkUserId, String status);

    List<BpAppPlanTask> findByStatus(String status);

    List<BpAppPlanTask> findByTaskId(Integer taskId);

    List<BpAppPlanTask> findByPlanIdAndStatus(Long planId, String status);

    List<BpAppPlanTask> findByCheckDate(LocalDate checkDate);

    List<BpAppPlanTask> findByCheckDateBetween(LocalDate startDate, LocalDate endDate);

    List<BpAppPlanTask> findByPlanIdAndCheckUserIdAndCheckDateAndStatus(Long planId, Long checkUserId,
                                                                        LocalDate checkDate, String status);

    List<BpAppPlanTask> findByTaskIdAndIdNot(Integer taskId, Long id);

}
